
import request from '../util/request'

export let getType = function ({commit, state}, {data, cb}) {
  console.log('000')
  request.$get('/api/gettype', data, (response) => {
    cb && cb(response)
  })
}

export let getProject = function ({commit, state}, {data, cb}) {
  request.$get('/api/getproject', data, (response) => {
    cb && cb(response)
  })
}

export let addProject = function ({commit, state}, {data, cb}) {
  request.$post('/api/updateproject', data, (response) => {
    cb && cb(response)
  })
}

export let addType = function ({commit, state}, {data, cb}) {
  request.$post('/api/updatetype', data, (response) => {
    cb && cb(response)
  })
}

export let addNews = function ({commit, state}, {data, cb}) {
  request.$post('/api/addnews', data, (response) => {
    cb && cb(response)
  })
}

export let login = function ({commit, state}, {data, cb}) {
  request.$get('/api/login', data, (response) => {
    cb && cb(response)
  })
}

export let deletNews = function ({commit, state}, {data, cb}) {
  request.$post('/api/deletenews', data, (response) => {
    cb && cb(response)
  })
}

export let getNews = function ({commit, state}, {data, cb}) {
  request.$get('/api/newslist', data, (response) => {
    cb && cb(response)
  })
}

export let deleteProject = function ({commit, state}, {data, cb}) {
  request.$post('/api/deleteproject', data, (response) => {
    cb && cb(response)
  })
}

export let deleteType = function ({commit, state}, {data, cb}) {
  request.$post('/api/deletetype', data, (response) => {
    cb && cb(response)
  })
}
